import axios from 'axios';

// axios.defaults.baseURL = 'http://107.172.103.237:9998/'
// 如果请求话费了超过 `timeout` 的时间，请求将被中断
axios.defaults.timeout = 50000
// 表示跨域请求时是否需要使用凭证
axios.defaults.withCredentials = false
// axios.defaults.headers.common['token'] =  AUTH_TOKEN
// axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
// 允许跨域
axios.defaults.headers.post['Access-Control-Allow-Origin-Type'] = '*'

axios.interceptors.response.use(function (response) {
  if(response.data.msg === "未登录"){
    location.href="/"
  }
  return response;
}, function (error) {
  return Promise.reject(error);
});


export default axios
